home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / archiver / scrnc102.zip / COMPRESS.BAT next >
DOS Batch File  |  1988-04-04  |  2KB  |  75 lines

  1. @echo off
  2. rem Please ignore the "bad command" message.  To stop it from recurring,
  3. rem edit COMPRESS.BAT, and remove the first line, which is supported
  4. rem only by DOS 3.3 and higher.
  5. echo off
  6. if %1x == x goto syntax
  7. if exist temp$$$$.com goto :error1
  8. if exist %1.com goto com
  9. if exist %1.exe goto exe
  10. echo Error: neither %1.COM nor %1.EXE was found.
  11. echo        For an explanation of COMPRESS, just type COMPRESS.
  12. echo  
  13. goto finish
  14. :syntax
  15. echo  
  16. echo Syntax:
  17. echo    COMPRESS programname
  18. echo  
  19. echo Explanation of COMPRESS
  20. echo    COMPRESS compresses executable files.  The file can be
  21. echo    either a .COM file or an .EXE file, and the result will
  22. echo    be a .COM file of the same name.
  23. echo  
  24. goto finish
  25. :com
  26. echo Compressing %1.COM
  27. echo  
  28. copy %1.com temp$$$$.com
  29. scrnch /rso %2 temp$$$$.com %1.com
  30. if errorlevel 8 goto error2
  31. copy temp$$$$.com temp$old.com
  32. del temp$$$$.com
  33. echo  
  34. echo COMPRESS is finished.
  35. echo The old version of %1.COM is saved as TEMP$OLD.COM.
  36. echo The new version is saved as %1.COM.
  37. echo Use the DIR command to see how much space was saved.
  38. goto finish
  39. :exe
  40. echo Compressing %1.EXE
  41. echo  
  42. scre2b %1.exe temp$$$$.com
  43. if errorlevel 8 goto error3
  44. copy %1.exe temp$old.exe
  45. scrnch /rso %2 temp$$$$.com %1.exe
  46. if errorlevel 8 goto error4
  47. del temp$$$$.com
  48. echo  
  49. echo COMPRESS is finished.
  50. echo The old version of %1.EXE is saved as TEMP$OLD.EXE.
  51. echo The new version is saved as %1.EXE.
  52. echo Use the DIR command to see how much space was saved.
  53. goto finish
  54. :error1
  55. echo Error: a previous run of COMPRESS left TEMP$$$$.COM on the
  56. echo        disk.  Perhaps it did not complete -- you should
  57. echo        investigate.
  58. goto finish
  59. :error2
  60. echo Error: SCRNCH of %1.COM did not complete.
  61. del %1.com
  62. copy temp$$$$.com %1.com
  63. del temp$$$$.com
  64. goto finish
  65. :error3
  66. echo Error: %1.EXE could not be converted to .COM format.
  67. del temp$$$$.com
  68. goto finish
  69. :error4
  70. echo Error: SCRNCH of %1.EXE did not complete.
  71. del temp$$$$.com
  72. copy temp$old.exe %1.exe
  73. goto finish
  74. :finish
  75.